<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <input type="text" v-myinput>

      <div v-myinput>xxx</div>

      <button v-disabled>禁止点击</button>

      <input type="text" v-color='msg'>
  </div>
  <script src="./vue.js"></script>
  <script>
      Vue.directive('myinput',{
          inserted: function(el) {
              console.log(el);
              el.focus()
              el.style.backgroundColor = 'red'
          }
      })

      Vue.directive('disabled',{
          inserted: function(el) {
             el.disabled = true
          }
      })

      Vue.directive('color',{
          inserted: function(el) {
              console.log('inserted')
          },
          bind: function(el,binding) {
              console.log('bind');
              console.log(binding);
              el.style.color = binding.value
          }
      })


    var vm = new Vue({
      el:'#app',
      data:{
          msg:"blue"
      },
      methods:{
      }
     });
  </script>
</body>
</html>
